#ifndef __WRAP_DIRECTINPUTDEVICE8__
#define __WRAP_DIRECTINPUTDEVICE8__

#include "game_server.h"

class WrapperDirectInputDevice8:public IDirectInputDevice8{
private:
	IDirectInputDevice8 * m_device;
	int id;
	// we need some buffer to be as the local virtual device, record the initiative data received from remote device
	// 1. the mouse

	
	Format m_format;

	// 2. the keyboard

	// 3. some other device

	// end of the buffers 
	/*
	Talk about the device, the status or the device info will receive from the remote or ignore it, I think that the first versioin will be just the standard function, modify it later
	*/
public:
	char tag;  // M for the mouse and K for the keyboard
	WrapperDirectInputDevice8(IDirectInputDevice8 *ptr,int _id);
	void SetID(int id);
	int GetID();

public:
	static int ins_count;

	/* IUnknown Method*/
	COM_METHOD(HRESULT,QueryInterface)(THIS_ REFIID riid, void **ppvObj);
	COM_METHOD(ULONG, AddRef)(THIS);
	COM_METHOD(ULONG, Release)(THIS);

	/* IDirectInputDevice8 methods*/
	COM_METHOD(HRESULT,Acquire)(THIS);
	COM_METHOD(HRESULT,BuildActionMap)(THIS_ LPDIACTIONFORMAT lpdiaf,LPCTSTR lpszUserName,DWORD dwFlags);
	COM_METHOD(HRESULT,CreateEffect)(THIS_ REFGUID rguid,
         LPCDIEFFECT lpeff,
         LPDIRECTINPUTEFFECT * ppdeff,
         LPUNKNOWN punkOuter);
	COM_METHOD(HRESULT, EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback,
         LPVOID pvRef,
         DWORD fl);
	COM_METHOD(HRESULT, EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACK lpCallback,
         LPVOID pvRef,
         DWORD dwEffType);
	COM_METHOD(HRESULT,EnumEffectsInFile)(THIS_ LPCSTR lpszFileName,
         LPDIENUMEFFECTSINFILECALLBACK pec,
         LPVOID pvRef,
         DWORD dwFlags);
	COM_METHOD(HRESULT, EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACK lpCallback,
         LPVOID pvRef,
         DWORD dwFlags);
	COM_METHOD(HRESULT, Escape)(THIS_ LPDIEFFESCAPE pesc);
	COM_METHOD(HRESULT, GetCapabilities)(THIS_ LPDIDEVCAPS lpDIDevCaps);
	COM_METHOD(HRESULT, GetDeviceData)(THIS_ DWORD cbObjectData,
         LPDIDEVICEOBJECTDATA rgdod,
         LPDWORD pdwInOut,
         DWORD dwFlags);
	COM_METHOD(HRESULT, GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCE pdidi);
	COM_METHOD(HRESULT, GetDeviceState)(THIS_ DWORD cbData,
         LPVOID lpvData);
	COM_METHOD(HRESULT, GetEffectInfo)(THIS_ LPDIEFFECTINFOA pdei,
         REFGUID rguid);
	COM_METHOD(HRESULT, GetForceFeedbackState)(THIS_ LPDWORD pdwOut);
	COM_METHOD(HRESULT, GetImageInfo)(THIS_ LPDIDEVICEIMAGEINFOHEADER lpdiDevImageInfoHeader);
	COM_METHOD(HRESULT, GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCE pdidoi,
         DWORD dwObj,
         DWORD dwHow);
	COM_METHOD(HRESULT, GetProperty)(THIS_ REFGUID rguidProp,
         LPDIPROPHEADER pdiph);
	COM_METHOD(HRESULT, Initialize)(THIS_ HINSTANCE hinst,
         DWORD dwVersion,
         REFGUID rguid);
	COM_METHOD(HRESULT, Poll)(THIS);
	COM_METHOD(HRESULT, RunControlPanel)(THIS_ HWND hwndOwner,
         DWORD dwFlags);
	COM_METHOD(HRESULT, SendDeviceData)(THIS_ DWORD cbObjectData,
         LPCDIDEVICEOBJECTDATA rgdod,
         LPDWORD pdwInOut,
         DWORD fl);
	COM_METHOD(HRESULT, SendForceFeedbackCommand)(THIS_ DWORD dwFlags);
	COM_METHOD(HRESULT, SetActionMap)(THIS_ LPDIACTIONFORMATA lpdiActionFormat,  LPCSTR lptszUserName,DWORD dwFlags);
	COM_METHOD(HRESULT, SetCooperativeLevel)(THIS_ HWND hwnd,
         DWORD dwFlags);
	COM_METHOD(HRESULT, SetDataFormat)(THIS_ LPCDIDATAFORMAT lpdf);
	COM_METHOD(HRESULT, SetEventNotification)(THIS_ HANDLE hEvent);
	COM_METHOD(HRESULT, SetProperty)(THIS_ REFGUID rguidProp,
         LPCDIPROPHEADER pdiph);
	COM_METHOD(HRESULT, Unacquire)(THIS);
	COM_METHOD(HRESULT, WriteEffectToFile)(THIS_ LPCSTR lpszFileName,
         DWORD dwEntries,
         LPDIFILEEFFECT rgDiFileEft,
         DWORD dwFlags);

};

#endif